package com.paradisecloudtech.vc.system.ui.widget;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class ScrollViewPager extends ViewPager {

    private boolean isCancelScroll = true;

    public ScrollViewPager(Context context) {
        super(context);
    }

    public ScrollViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void setCancelScroll(boolean isCanScroll) {

        this.isCancelScroll = isCanScroll;

    }

    @Override
    public boolean onTouchEvent(MotionEvent arg0) {
        if (isCancelScroll)
            return false;
        else
            return super.onTouchEvent(arg0);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent arg0) {
        if (isCancelScroll)
            return false;
        else
            return super.onInterceptTouchEvent(arg0);
    }
}
